﻿//dropmenu
function dropMenu(obj){
		$(obj).each(function(){
			var theSpan = $(this);
			var theMenu = theSpan.find(".submenu");
			var tarHeight = theMenu.height();
			theMenu.css({height:0,opacity:0});
			
			var t1;
			
			function expand() {
				clearTimeout(t1);
				theSpan.find('a').addClass("selected");
				theMenu.stop().show().animate({height:tarHeight,opacity:1},200);
			}
			
			function collapse() {
				clearTimeout(t1);
				t1 = setTimeout(function(){
					theSpan.find('a').removeClass("selected");
					theMenu.stop().animate({height:0,opacity:0},200,function(){
						$(this).css({display:"none"});
					});
				}, 250);
			}
			
			theSpan.hover(expand, collapse);
			theMenu.hover(expand, collapse);
		});
	}

$(function(){
	dropMenu(".drop-menu-effect");
});


//time-line
$(function(){
   $(".time-line .comment-content").css('display','none');
   $('.time-line h3').click(function(event) {
       var dd = $(this).next('.time-line .comment-content');
       var display = dd.css('display');
       if (display == 'none') {
           $(".time-line .comment-content").hide(0).eq($('.time-line h3').index(this)).show(0); 
       }else{
           dd.slideToggle(0);
       }
   });
})


//tabs
$(function(){
	jQuery.jqtab = function(tabtit,tab_conbox,shijian) {
		//$(tab_conbox).find("li").hide();
		$(tabtit).find("li:first").addClass("curr").show(); 
		$(tab_conbox).find("li:first").show();
		$(tabtit).find("li").bind(shijian,function(){
		  $(this).addClass("curr").siblings("li").removeClass("curr"); 
			var activeindex = $(tabtit).find("li").index(this);
			$(tab_conbox).children().eq(activeindex).show().siblings().hide();
			return false;
		});
	
	};
	$.jqtab("#tabs","#tab_conbox","click");
	$.jqtab("#tabs2","#tab_conbox2","mouseenter");
});

//disabled
$(function(){
$('.disabled a').removeAttr('href');
$('.disabled a').removeAttr('onclick');
});

//input num
function IsNum(e) {
  var k = window.event ? e.keyCode : e.which;
    if (((k >= 48) && (k <= 57)) || k == 8 || k == 0) {
     } else {
       if (window.event) {
        window.event.returnValue = false;
           }
           else {
                    e.preventDefault(); //for firefox 
           }
       }
    } 